Dynamic Weights
InterSwap introduces a new mechanism for dynamically adjusting token weights during single-asset liquidity provision and removal. Adding liquidity proportionally increases the asset’s weight, while removing liquidity decreases it.
Liquidity provision and removal do not affect swap quotes. This mechanism prevents the possibility of draining the pool.
Let’s consider an example of an initial pool with equal weights:
Asset | Reserve | Weight Points |
---|---|---|
BNB | 20000 | 1000 |
ETH | 5000 | 1000 |
AVAX | 45000 | 1000 |
Total Weight: 3000
We are adding 20 ETH liquidity. Let's calculate how many weight points should be added to ETH.
price per point = reserve / points count.
Where:
- - points to be added or reduced.
- - amount of tokens added or removed.
- - current reserve of token.
- - total points.
In our example:
points = 20 / (5000 / 1000) = 4
Asset | Reserve | Weight Points |
---|---|---|
BNB | 20000 | 1000 |
ETH | 5020 | 1004 |
AVAX | 45000 | 1000 |
Total Weight: 3004